package com.krim;

import java.io.IOException;
import java.util.Date;
import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.krim.util.PMF;

@SuppressWarnings("serial")
public class KeruimuServlet extends HttpServlet{
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException{

//		Employee employee = new Employee("Alfred", "Smith", new Date());
//		PersistenceManager pm = PMF.get().getPersistenceManager();
//		try {
//			pm.makePersistent(employee);
//			String query = "select from " + Employee.class.getName() + " where lastName == 'Smith'";
//			List<Employee> employees = (List<Employee>) pm.newQuery(query).execute();
//			System.out.println(employees.size());
//
//			Query query2 = pm.newQuery(Employee.class, "lastName == lastNameParam order by hireDate desc");
//			query2.declareParameters("String lastNameParam");
//
//			List<Employee> results = (List<Employee>) query2.execute("Smith");
//
//			Employee e = pm.getObjectById(Employee.class, 1);
//			e.setFirstName("newName");
//		} finally {
//			pm.close();
//		}

		resp.setContentType("text/plain");
		resp.getWriter().println("Hello, world");
	}
}
